<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<div class="block clearfix">
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        
        <h2>Groups</h2>
        
        <ul>
            <li>
                <html:link action="/admin/group.do" >
                    Add Group
                </html:link>
            </li>
        </ul>
    </div>
    <!-- .block_head ends -->

    <html:form action="admin/groupListing.do" method="post">
    
        <div class="block_content clearfix">
            <logic:notEmpty name="errorMessage" >
                <div class="message errormsg"><p><bean:write name="errorMessage"/></p></div>
            </logic:notEmpty>
            <logic:notEmpty name="successMessage" >
                <div class="message success"><p><bean:write name="successMessage"/></p></div>
            </logic:notEmpty>
            <table cellpadding="0" cellspacing="0" width="100%" class="sortable">
                
                <thead>
                    <tr>
                        <th>Group Name</th>
                        <td width="175">&nbsp;</td>
                    </tr>
                </thead>
                
                <tbody>
                    <logic:empty name="groupList">
                        <tr>
                            <td class="align-center" colspan="2">There are no groups</td>
                        </tr>
                    </logic:empty>
                    <logic:notEmpty name="groupList">
                        <logic:iterate id="group" name="groupList">
                            <tr>
                                <td>     
                                    <bean:write name="group" property="groupName"/>
                                </td>
                                <td class="delete">
                                    <html:link action="/admin/group.do?action=edit" paramId="groupID" paramName="group" paramProperty="groupID">
                                        Edit
                                    </html:link>
                                    <logic:greaterThan name="group" property="groupID" value="2">
                                        <html:link styleClass="confirm-button" action="/admin/groupListing.do?action=delete" paramId="groupID" paramName="group" paramProperty="groupID">
                                            Delete
                                        </html:link>
                                    </logic:greaterThan>
                                    <html:link action="/admin/permission.do" paramId="groupID" paramName="group" paramProperty="groupID">
                                        &rarr;
                                    </html:link>
                                </td>
                            </tr>
                        </logic:iterate>
                    </logic:notEmpty>
                </tbody>
                
            </table>
        </div>
        <!-- .block_content ends -->
    </html:form>
    
    <div class="bendl"></div>
    <div class="bendr"></div>
</div>
<!-- .block ends -->